<!DOCTYPE html>
<html lang="en" dir="ltr">
    <head>
        <meta charset="utf-8">
        <title>文件列表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    </head>
    <body>
		<div style="margin:50px;">
			<ul class="imglist" id="imglist">

			</ul>
		</div>
    </body>
<script src="//mirror.fe80.cn/layui/2.6.8/layui.js"></script>
<script src="/static/js/global.js"></script>
<script>
var path = '/uploads/'+(new Date()).getFullYear()+'/';
var filedomain = domain.upyun;
var api = domain.api + '/tools/sdk/upyun.html';
var push = {method:'read',read:path};

layui.use(['form'],function(){
    var $ = layui.$;
    $.post(api,push,function(res){
        console.log(res);
        renderList(res.read.files,push.read);
    });
})

function renderList(il,path = ''){
    var d = document.getElementById('imglist');
    var _html = '';
    for (var i = 0; i < il.length; i++) {
        if(il[i].type == 'N'){
            _html += '<li><a href="'+filedomain + path + il[i].name+'">'+il[i].name+'</a></li>';
        }
    }
    console.log(_html);
    d.innerHTML = _html;
}
</script>

<script type="text/javascript" src="//mirror.fe80.cn/jquery/3.6.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://mirror.fe80.cn/viewerjs/1.10.1/viewer.min.css">
<script type="text/javascript" src="https://mirror.fe80.cn/viewerjs/1.10.1/viewer.min.js"></script>
<script type="text/javascript">
    // 打开窗口
    $('#imglist').on('click','img',function(){
        $("#imglist").viewer({"title":0});
    });
</script>
</html>
